<!--
 * @Description: 工程管理
 * @Author: wangwangwang
 * @Date: 2020-08-17 15:52:03
 * @LastEditors: wangwangwang
 * @LastEditTime: 2021-03-24 09:34:02
-->
<template>
  <div class="pages_content table">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <el-main>
        <div class="tabtop" style="width:380px;">
          <div v-for="(item, index) in contractTypelist" :key="index" @click="choose(item.status)">
            <div :class="currenindex == item.status ? 'active' : 'text'">{{ item.value }}</div>
          </div>
        </div>
        <div class="header_right" @click="showCardNav = !showCardNav">
          <div class="title">搜索</div>
          <div>
            <transition name="from"></transition>
            <span v-show="!showCardNav">
              <i style="margin-right: 5px" class="el-icon-arrow-down"></i>
            </span>
            <transition name="to"></transition>
            <span v-show="showCardNav">
              <i style="margin-right: 5px" class="el-icon-arrow-up"></i>
            </span>
          </div>
        </div>
        <div v-show="showCardNav" class="hr"></div>
        <el-collapse-transition>
          <div v-show="showCardNav">
            <div class="search">
              <span style="display: inline-block;margin-bottom: 10px;">
                <span style="margin-right: 12px">财务编码</span>
                <el-input v-model="tableParam.financialCode" style="width: 180px" clearable placeholder="请输入" />
              </span>
              <span style="margin-left: 24px">
                <span style="margin-right: 12px">工程名称</span>
                <el-input v-model="tableParam.name" style="width: 180px; min-width: 150px; max-width: 220px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
              </span>
              <!-- <span style="margin-left: 24px">
                <span style="margin-right: 12px">合同号</span>
                <el-input v-model="tableParam.code" style="width: 180px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
              </span> -->
              <span style="margin-left: 24px">
                <span style="margin-right: 12px">合同单位</span>
                <el-input v-model="tableParam.roadwork" style="width: 180px; min-width: 150px; max-width: 220px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
              </span>
              <!-- <span style="margin-left: 24px">
                <span style="margin-right: 12px">负责人</span>
                <el-input v-model="tableParam.principal" style="width: 180px; min-width: 150px; max-width: 220px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
              </span> -->
              <!-- <span style="margin-left: 24px">
                <span style="margin-right: 12px">交底时间</span>
                <el-date-picker v-model="tableParam.time" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" unlink-panels range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间">
                </el-date-picker>
              </span> -->
              <el-button icon="el-icon-search" size="medium" class="bottom_all but1" @click="searchSubmit">查 询</el-button>
              <el-button size="medium" class="bottom_all_two" style="margin-left: 12px" @click="init()">重 置</el-button>
            </div>
          </div>
        </el-collapse-transition>
        <div class="hr"></div>
        <div class="card" style="padding-top: 10px">
          <div v-loading="tableLoading" class="card_info" :style="style">
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="tableData" tooltip-effect="dark" @selection-change="handleSelectionChange">
              <el-table-column width="200" prop="code" align="center" label="工程编号"></el-table-column>
              <el-table-column prop="name" align="center" label="工程名称">
                <!-- <template slot-scope="scope">
                  <span style="color: #008200; cursor: pointer" @click="datails(scope.row)">{{ scope.row.name }}</span>
                </template> -->
              </el-table-column>
              <el-table-column width="150" prop="financialCode" align="center" label="财务编码"></el-table-column>
              <el-table-column align="center" prop="ccContractNo" label="建委合同号"></el-table-column>
              <el-table-column align="center" prop="contractNo" label="合同号"></el-table-column>
              <el-table-column align="center" prop="roadwork" label="合同单位"></el-table-column>
              <el-table-column align="center" label="交底信息" width="90">
                <template slot-scope="scope">
                  <el-button size="mini" class="bottom_one" @click="regisSubmit(scope.row,true,2)">查看</el-button>
                </template>
              </el-table-column>
              <!-- <el-table-column align="center" label="价格调整" width="80">
                <template slot-scope="scope">
                  <el-link class="table_link" :underline="false" @click="hanldeprice(scope.row)">调价</el-link>
                </template>
              </el-table-column> -->
              <!-- <el-table-column align="center" label="供应约定" width="130">
                <template slot-scope="scope">
                  <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='CHAKAN'))!==-1" size="mini" class="bottom_one" @click="hanldeDisInfo(scope.row)">查看/编辑</el-button>
                </template>
              </el-table-column> -->
              <el-table-column align="center" label="资信记录" width="90">
                <template slot-scope="scope">
                  <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='GENGXIN'))!==-1" size="mini" class="bottom_one" @click="hanldeByType(scope.row)"><span v-if="currenindex==1">更新</span><span v-if="currenindex==2">查看</span></el-button>
                </template>
              </el-table-column>
              <el-table-column align="center" label="账款记录" width="90">
                <template slot-scope="scope">
                  <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='GENGXIN'))!==-1" size="mini" class="bottom_one" @click="hanldeAccount(scope.row)"><span v-if="currenindex==1">更新</span><span v-if="currenindex==2">查看</span></el-button>
                </template>
              </el-table-column>
              <el-table-column align="center" label="风险管控" width="90">
                <template slot-scope="scope">
                  <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='GENGXIN'))!==-1" size="mini" class="bottom_one" @click="hanldeRiskcontrol(scope.row)"><span v-if="currenindex==1">更新</span><span v-if="currenindex==2">查看</span></el-button>
                </template>
              </el-table-column>
              <el-table-column align="center" label="分配账号" width="90">
                <template slot-scope="scope">
                  <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='FENPEI'))!==-1" size="mini" class="bottom_one" @click="hanldeShare(scope.row)"><span v-if="currenindex==1">分配</span><span v-if="currenindex==2">查看</span></el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="card_bottom">
            <div class="card_bottom_left">
              <div class="top_page_totle">总共{{ total }}条</div>
              <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" layout="prev, pager, next, jumper" :total="total" @current-change="gettableData()"></el-pagination>
            </div>
            <div>
              <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
            </div>
          </div>
        </div>
      </el-main>
    </el-container>
    <!-- 工程详情 -->
    <el-dialog v-dialogDrag :visible.sync="show" width="1200px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">工程信息</span>
      <div class="dialoginfo show">
        <el-form :inline="true" label-width="110px">
          <div class="form-title">工程基本信息</div>
          <el-form-item prop="name">
            <span slot="label" style="color:#FF0000;">工程名称</span>
            <el-input v-model="fromDate.name" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="place">
            <span slot="label" style="color:#FF0000;">地理位置</span>
            <el-input v-model="fromDate.place" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="expectedAmount" label-width="160px">
            <span slot="label" style="color:#FF0000;">预估用砼量（方）</span>
            <el-input v-model="fromDate.expectedAmount" style="width: 176px;" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="typeId">
            <span slot="label">工程性质</span>
            <el-input v-model="fromDate.type" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="rateOfProgressId">
            <span slot="label">项目进度</span>
            <el-input v-model="fromDate.rateOfProgress" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="startTime">
            <span slot="label">起供时间</span>
            <el-date-picker v-model="fromDate.startTime" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" disabled></el-date-picker>
          </el-form-item>
          <el-form-item prop="tubularColumn">
            <span slot="label">管柱（米）</span>
            <el-input v-model="fromDate.tubularColumn" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="fabricated">
            <span slot="label">装配式</span>
            <el-input v-model="fromDate.fabricated" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <el-form-item prop="fabricated">
            <span slot="label">现场情况</span>
            <el-input v-model="fromDate.currentSituation" placeholder="请输入" disabled></el-input>
          </el-form-item>
          <div>
            <el-form-item prop="roadwork">
              <span slot="label" style="color:#FF0000;">施工单位</span>
              <el-input v-model="fromDate.roadwork" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="roadworklInkman">
              <span slot="label" style="color:#FF0000;">联系人</span>
              <el-input v-model="fromDate.roadworklInkman" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="roadworkPhone">
              <span slot="label" style="color:#FF0000;">电话</span>
              <el-input v-model="fromDate.roadworkPhone" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="constructionUnit">
              <span slot="label">建设单位</span>
              <el-input v-model="fromDate.constructionUnit" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="cuLinkman">
              <span slot="label">联系人</span>
              <el-input v-model="fromDate.cuLinkman" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="cuPhone">
              <span slot="label">电话</span>
              <el-input v-model="fromDate.cuPhone" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="contractSigningUnit">
              <span slot="label">合同单位</span>
              <el-input v-model="fromDate.contractSigningUnit" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="clientTypeId">
              <span slot="label">客户类型</span>
              <el-input v-model="fromDate.clientType" placeholder="请输入" disabled></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item prop="businessTypeId">
              <span slot="label" style="color:#FF0000;">业务类型</span>
              <el-input v-model="fromDate.businesName" placeholder="请输入" disabled></el-input>
            </el-form-item>
            <el-form-item prop="executePhase">
              <span slot="label" style="color:#FF0000;">执行阶段</span>
              <el-select v-model="fromDate.executePhase" placeholder="请选择" disabled>
                <el-option label="委托交底" :value="1"></el-option>
                <el-option label="评估" :value="2"></el-option>
                <el-option label="投标" :value="3"></el-option>
                <el-option label="合同交底" :value="4"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <el-form-item prop="remark">
            <span slot="label">备注</span>
            <el-input v-model="fromDate.remark" style="width: 920px;" type="textarea" :rows="5" resize="none" placeholder="请输入" disabled></el-input>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="show=false">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 交底 -->
    <clarificaitonModel :visible="clarifiVisible" :disabled="isReadOnly" :data="claritem" :handleType="type" @closeSubmit="closeSubmit" />
    <!-- 价格调整 -->
    <el-dialog v-dialogDrag :visible.sync="Dialog.indexOf(activeDialog) == 0" width="880px" :close-on-click-modal="false" :before-close="restOther">
      <span slot="title" class="dialog-title">价格调整</span>
      <div class="dialoginfo" style="padding: 0">
        <div>
          <el-button size="mini" class="bottom_all" style="margin-left: 0" @click="pricing(1)">单个调整</el-button>
          <el-button size="mini" class="bottom_all" style="margin-left: 24px" @click="pricing(2)">批量调整</el-button>
        </div>
        <div class="form-title">初始基本价格：</div>
        <div class="price-table1">
          <div>
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="priceData.adjustTab" tooltip-effect="dark">
              <el-table-column label="标号" align="center" prop="itemType"></el-table-column>
              <el-table-column label="基本价格" align="center" prop="rates"></el-table-column>
            </el-table>
          </div>
          <div>
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="priceData.adjustSurcharge" tooltip-effect="dark">
              <el-table-column label="附加收费项" align="center" prop="itemType"></el-table-column>
              <el-table-column label="收费标准" align="center" prop="rates"></el-table-column>
            </el-table>
          </div>
        </div>
        <div class="form-title">价格调整列表：</div>
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="priceData.adjustTab" tooltip-effect="dark">
          <el-table-column label="标号" align="center" prop="itemType"></el-table-column>
          <el-table-column label="调整价格" align="center" prop="revisePrice"></el-table-column>
          <el-table-column label="生效日期" align="center" prop="effectiveDate"></el-table-column>
          <el-table-column label="调整时间" align="center" prop="updateTime"></el-table-column>
          <el-table-column label="操作" align="left" prop="itemType">
            <template slot-scope="scope">
              <el-button size="small" class="bottom_two" @click="
                  deleteprice(scope.row, scope.$index, priceData.adjustTab)
                ">
                <i class="icon iconfont iconicon_button_delete" style="font-size: 12px"></i>
                删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <div style="padding-top: 10px">
          <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="priceData.adjustSurcharge" tooltip-effect="dark">
            <el-table-column label="附加收费项" align="center" prop="itemType"></el-table-column>
            <el-table-column label="调整价格" align="center" prop="revisePrice"></el-table-column>
            <el-table-column label="生效日期" align="center" prop="effectiveDate"></el-table-column>
            <el-table-column label="调整时间" align="center" prop="updateTime"></el-table-column>
            <el-table-column label="操作" align="left" prop="itemType">
              <template slot-scope="scope">
                <el-button size="small" class="bottom_two" @click="
                    deleteprice(
                      scope.row,
                      scope.$index,
                      priceData.adjustSurcharge
                    )
                  ">
                  <i class="icon iconfont iconicon_button_delete" style="font-size: 12px"></i>
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="restOther">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 调价 -->
    <el-dialog v-dialogDrag :visible.sync="pricingdialog" width="780px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">{{
        pricingType == 1 ? "单个调价" : "批量调价"
        }}</span>
      <div class="dialoginfo">
        <div v-if="pricingType == 1" class="price-table1">
          <div style="
              border: 1px solid #e1e5ed;
              padding: 30px 10px 10px;
              border-radius: 4px;
            ">
            <el-form ref="reffromDate" :inline="true" label-width="90px">
              <el-form-item prop="code">
                <span slot="label">选择标号</span>
                <el-select v-model="pricingId2" placeholder="请选择" style="width: auto">
                  <el-option v-for="(item, index) in priceData.adjustTab" :key="index" :label="item.itemType" :value="item.id"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">调整价格</span>
                <el-input v-model="pricingData1.revisePrice" style="width: auto" placeholder="请输入" clearable></el-input>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">生效日期</span>
                <el-date-picker v-model="pricingData1.effectiveDate" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
              </el-form-item>
            </el-form>
          </div>
          <div style="
              border: 1px solid #e1e5ed;
              padding: 30px 10px 10px;
              border-radius: 4px;
            ">
            <el-form ref="reffromDate" :inline="true" label-width="90px">
              <el-form-item prop="code">
                <span slot="label">附加收费项</span>
                <el-select v-model="pricingId2" placeholder="请选择" style="width: auto">
                  <el-option v-for="(item, index) in priceData.adjustSurcharge" :key="index" :label="item.itemType" :value="item.id"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">调整价格</span>
                <el-input v-model="pricingData2.revisePrice" style="width: auto" placeholder="请输入" clearable></el-input>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">生效日期</span>
                <el-date-picker v-model="pricingData2.effectiveDate" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
              </el-form-item>
            </el-form>
          </div>
        </div>

        <div v-else class="price-table1">
          <div style="
              border: 1px solid #e1e5ed;
              padding: 30px 10px 10px;
              border-radius: 4px;
            ">
            <el-form ref="reffromDate" :inline="true" label-width="90px">
              <el-form-item prop="code" label-width="0">
                <div class="radio">
                  <el-checkbox-group v-model="pricingIds1">
                    <template v-for="(item, index) in priceData.adjustTab">
                      <div :key="index" class="radio-bg">
                        <el-checkbox :label="item.id">{{
                          item.itemType
                          }}</el-checkbox>
                      </div>
                    </template>
                  </el-checkbox-group>
                </div>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label" style="color: #ff0000">调整价格</span>
                <el-input v-model="pricingData1.revisePrice" style="width: auto" placeholder="请输入" clearable></el-input>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label" style="color: #ff0000">生效日期</span>
                <el-date-picker v-model="pricingData1.effectiveDate" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
              </el-form-item>
            </el-form>
          </div>
          <div style="
              border: 1px solid #e1e5ed;
              padding: 30px 10px 10px;
              border-radius: 4px;
            ">
            <el-form ref="reffromDate" :inline="true" label-width="90px">
              <el-form-item prop="code" label-width="0">
                <div class="radio">
                  <el-checkbox-group v-model="pricingIds2">
                    <template v-for="(item, index) in priceData.adjustSurcharge">
                      <div :key="index" class="radio-bg">
                        <el-checkbox :label="item.id">{{
                          item.itemType
                          }}</el-checkbox>
                      </div>
                    </template>
                  </el-checkbox-group>
                </div>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label" style="color: #ff0000">调整价格</span>
                <el-input v-model="pricingData2.revisePrice" style="width: auto" placeholder="请输入" clearable></el-input>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label" style="color: #ff0000">生效日期</span>
                <el-date-picker v-model="pricingData2.effectiveDate" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="pricingdialog = false">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px" @click="submitpricing()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 供应约定 -->
    <el-dialog v-dialogDrag :visible.sync="Dialog.indexOf(activeDialog) == 1" width="780px" :close-on-click-modal="false" :before-close="restOther">
      <span slot="title" class="dialog-title">供应约定</span>
      <div class="dialoginfo">
        <el-form ref="reffromDate" :inline="true" :model="DisInfoData" label-width="110px">
          <el-form-item>
            <span slot="label">首次供砼时间：</span>
            <el-date-picker v-model="DisInfoData.firstSupplyTime" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
          </el-form-item>
          <el-form-item>
            <span slot="label">末次供砼时间：</span>
            <el-date-picker v-model="DisInfoData.lastSupplyTime" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
          </el-form-item>
          <el-form-item>
            <span slot="label">封顶时间：</span>
            <el-date-picker v-model="DisInfoData.buildEndTime" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
          </el-form-item>
          <el-form-item>
            <span slot="label">正负零层时间：</span>
            <el-date-picker v-model="DisInfoData.plusOrMinusTime" style="width: 215px" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
          </el-form-item>
          <el-form-item>
            <span slot="label">备注：</span>
            <el-input v-model="DisInfoData.supplyRemark" style="width:500px;" type="textarea" />
          </el-form-item>
          <br />
          <el-form-item>
            <span slot="label">付款约定：</span>
            <div style="width: 550px">{{ DisInfoData.paymentAgree }}</div>
          </el-form-item>
          <br />
          <el-form-item>
            <span slot="label">结算约定：</span>
            <div style="width: 550px">{{ DisInfoData.settlementAgree }}</div>
          </el-form-item>
          <br />
          <el-form-item>
            <span slot="label">发票约定：</span>
            <div style="width: 550px">{{ DisInfoData.ticketAgree }}</div>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="restOther">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px" @click="submitDisInfo()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 资信记录 -->
    <el-dialog v-dialogDrag :visible.sync="Dialog.indexOf(activeDialog) == 2" width="780px" :close-on-click-modal="false" :before-close="restOther">
      <span slot="title" class="dialog-title">资信记录</span>
      <div class="dialoginfo" style="padding: 0">
        <div class="dialoginfo-title">
          <div :class="type == 1 ? 'active' : 'none'" @click="type = 1">
            <div>供应索赔记录</div>
          </div>
          <div :class="type == 2 ? 'active' : 'none'" @click="type = 2">
            <div>质量索赔记录</div>
          </div>
          <div :class="type == 3 ? 'active' : 'none'" @click="type = 3">
            <div>逾期付款记录</div>
          </div>
          <div :class="type == 4 ? 'active' : 'none'" @click="type = 4">
            <div>逾期结算记录</div>
          </div>
          <div :class="type == 5 ? 'active' : 'none'" @click="type = 5">
            <div>公信平台预警信息</div>
          </div>
        </div>
        <div class="dialoginfo-info">
          <el-timeline v-if="ByTypeData.length">
            <template v-for="(item, index) in ByTypeData">
              <el-timeline-item :key="index" :timestamp="item.createTime" placement="top">
                <el-card>
                  <p>{{ item.content }}</p>
                  <div style="text-align: right; color: #808080">
                    更新人：{{ item.createUserName }}
                  </div>
                </el-card>
              </el-timeline-item>
            </template>
          </el-timeline>
          <div v-else class="no-data">暂无数据</div>
        </div>
        <div v-if="currenindex!=2">
          <span>填写更新内容：</span>
          <div style="padding: 20px 20px 0 68px">
            <el-input v-model="content" type="textarea" :rows="5" resize="none" placeholder="请输入" clearable></el-input>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="restOther">取 消</el-button>
        <el-button v-if="currenindex!=2" class="bottom_all" style="margin-left: 24px" @click="submitByType()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 账款记录 -->
    <el-dialog v-dialogDrag :visible.sync="Dialog.indexOf(activeDialog) == 3" width="1140px" :close-on-click-modal="false" :before-close="restOther">
      <span slot="title" class="dialog-title">账款&效益</span>
      <div class="dialoginfo">
        <!-- <div class="dialoginfo-title" style="margin-bottom:20px;">
          <div :class="econType == 1 ? 'active' : 'none'" @click="econType = 1">
            <div>账款记录</div>
          </div>
          <div :class="econType == 2 ? 'active' : 'none'" @click="econType = 2">
            <div>经济效益</div>
          </div>
        </div> -->
        <el-form v-show="econType===1" :inline="true" label-width="110px">
          <div v-if="currenindex!=2" style="padding-bottom: 20px">
            <el-button size="mini" class="bottom_all" style="margin-left: 0" @click="addaccountItem()">
              <i class="icon iconfont iconicon_button_add" style="font-size: 12px"></i>
              添加收款
            </el-button>
          </div>
          <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="AccountableData" tooltip-effect="dark" show-overflow-tooltip>
            <el-table-column label="收款日期" align="center" prop="yearMonth"></el-table-column>
            <el-table-column label="收款形式" align="center" prop="payment">
              <template slot-scope="scope">
                <span v-if="scope.row.payment==1">现金转账</span>
                <span v-if="scope.row.payment==2">银行承兑</span>
                <span v-if="scope.row.payment==3">商业承兑</span>
                <span v-if="scope.row.payment==4">抵进原材料</span>
                <span v-if="scope.row.payment==5">抵进动产</span>
                <span v-if="scope.row.payment==6">其他</span>
              </template>
            </el-table-column>
            <el-table-column label="收款金额" align="center" prop="realIncome"></el-table-column>
            <el-table-column label="票据号" align="center" prop="invoiceNumber"></el-table-column>
            <el-table-column label="出票日" align="center" prop="dateOfDraft"></el-table-column>
            <el-table-column label="到期日" align="center" prop="dateOfexpire"></el-table-column>
            <el-table-column label="贴息及相关费用" align="center" prop="disposeLog"></el-table-column>
            <el-table-column label="操作" align="left" width="120px">
              <template slot-scope="scope">
                <el-link class="table_link" :underline="false" @click="updateaccountItem(scope.row)">修改</el-link>
                <el-link class="table_link" :underline="false" @click="delteteaccountItem(scope.row)">删除</el-link>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
        <!-- <div v-show="econType===2">
          <div v-if="currenindex!=2" style="padding-bottom: 20px">
            <el-button size="mini" class="bottom_all" style="margin-left: 0" @click="addEconomic()">
              <i class="icon iconfont iconicon_button_add" style="font-size: 12px"></i>
              添加效益
            </el-button>
          </div>
          <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="economicData" tooltip-effect="dark">
            <el-table-column label="年/月" align="center" prop="yearMouth"></el-table-column>
            <el-table-column label="基础销售额" align="center" prop="sales"></el-table-column>
            <el-table-column label="特添营收" align="center" prop="addRevenue"></el-table-column>
            <el-table-column label="泵送营收" align="center" prop="pumpingRevenue"></el-table-column>
            <el-table-column label="主材成本" align="center" prop="principalMaterialCost"></el-table-column>
            <el-table-column label="特添加成本" align="center" prop="addMaterialCost"></el-table-column>
            <el-table-column label="运输成本" align="center" prop="carriageCost"></el-table-column>
            <el-table-column label="泵送成本" align="center" prop="pumpingCost"></el-table-column>
          </el-table>
        </div> -->
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="restOther">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 更新账款记录 -->
    <el-dialog v-dialogDrag :visible.sync="accountItemDialog" width="780px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">更新账款记录</span>
      <div class="dialoginfo" style="padding: 20px 0 0 0">
        <el-form ref="reffromDate" :inline="true" label-width="110px">
          <el-form-item label="收款日期">
            <el-date-picker v-model="accountItem.yearMonth" type="month" value-format="yyyy-MM" placeholder="选择年月"></el-date-picker>
          </el-form-item>
          <el-form-item label="收款形式">
            <el-select v-model="accountItem.payment" placeholder="请选择">
              <el-option label="现金转账" :value="1"></el-option>
              <el-option label="银行承兑" :value="2"></el-option>
              <el-option label="商业承兑" :value="3"></el-option>
              <el-option label="抵进原材料" :value="4"></el-option>
              <el-option label="抵进动产" :value="5"></el-option>
              <el-option label="其他" :value="6"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="code">
            <template slot="label">
              <span style="color: #ff0000">收款金额</span>
            </template>
            <el-input v-model="accountItem.realIncome" style="width: 240px" placeholder="请输入" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="accountItem.realIncome=$regExp.checkNum(accountItem.realIncome)" @blur="accountItem.realIncome=$regExp.blurCheckNum(accountItem.realIncome)"></el-input>
          </el-form-item>
          <el-form-item prop="code">
            <template slot="label">
              <span style="color: #ff0000">票据号</span>
            </template>
            <el-input v-model="accountItem.invoiceNumber" style="width: 240px" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="code">
            <template slot="label">
              <span style="color: #ff0000">出票日</span>
            </template>
            <el-date-picker v-model="accountItem.dateOfDraft" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选选择"></el-date-picker>
          </el-form-item>
          <el-form-item prop="code">
            <template slot="label">
              <span style="color: #ff0000">到期日</span>
            </template>
            <el-date-picker v-model="accountItem.dateOfexpire" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选选择"></el-date-picker>
          </el-form-item>
          <div>
            <el-form-item prop="code" label="贴息及相关费用">
              <el-input v-model="accountItem.disposeLog" style="width: 617px" type="textarea" :rows="4" resize="none" placeholder="请输入" clearable></el-input>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="accountItemDialog = false">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px" @click="submitaccountItem()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 添加经济效益 -->
    <!-- <el-dialog v-dialogDrag :visible.sync="economicVisible" width="780px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">添加经济效益</span>
      <div class="dialoginfo" style="padding: 20px 0 0 0">
        <el-form ref="economicForm" :model="economicForm" :inline="true" label-width="110px">
          <el-form-item prop="yearMouth">
            <span slot="label">年/月</span>
            <el-date-picker v-model="economicForm.yearMouth" type="month" value-format="yyyy-MM" placeholder="选择年月"></el-date-picker>
          </el-form-item>
          <div class="FzyForm">
            <div>
              <title>营收</title>
              <el-form-item prop="sales" label="销量">
                <el-input v-model="economicForm.sales" style="width:140px;" placeholder="请输入" clearable type="Number"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button class="bottom_all_two" @click="getSales">获取</el-button>
              </el-form-item>
              <el-form-item prop="unitPrice" label="综合单价">
                <el-input v-model="economicForm.unitPrice" placeholder="请输入" clearable type="Number"></el-input>
              </el-form-item>
              <el-form-item prop="financialExpense" label="财务费用">
                <el-input v-model="economicForm.financialExpense" placeholder="请输入" clearable type="Number"></el-input>
              </el-form-item>
            </div>
            <div>
              <title>营收</title>
              <el-form-item prop="sales" label="销量">
                <el-input v-model="economicForm.sales" style="width:140px;" placeholder="请输入" clearable type="Number"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button class="bottom_all_two" @click="getSales">获取</el-button>
              </el-form-item>
              <el-form-item prop="unitPrice" label="综合单价">
                <el-input v-model="economicForm.unitPrice" placeholder="请输入" clearable type="Number"></el-input>
              </el-form-item>
              <el-form-item prop="financialExpense" label="财务费用">
                <el-input v-model="economicForm.financialExpense" placeholder="请输入" clearable type="Number"></el-input>
              </el-form-item>
            </div>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="economicVisible = false">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px" @click="handleAdd()">确 定</el-button>
      </span>
    </el-dialog> -->
    <!-- 风险管控-->
    <el-dialog v-dialogDrag :visible.sync="Dialog.indexOf(activeDialog) == 4" width="80%" :close-on-click-modal="false" :before-close="restOther">
      <span slot="title" class="dialog-title">风险管控信息</span>
      <el-form ref="reffromDate" label-width="110px" label-position="top">
        <div class="control">
          <div style="width:35%;">
            <div class="control-title">限时</div>
            <div style="padding: 20px">
              <el-form-item prop="code">
                <span slot="label">施工工期：</span>
                <div>起：{{ Riskcontrol.beginTime }}</div>
                <div>止：{{ Riskcontrol.finishTime }}</div>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">限时设置：</span>
                <el-date-picker v-model="Riskcontrol.limitTime" type="daterange" size="small" :disabled="currenindex==2" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
                </el-date-picker>
                <!-- <span>起：</span>
                <el-date-picker v-model="Riskcontrol.limitBeginTime" :disabled="currenindex==2" style="width: 225px" type="date" value-format="yyyy-MM-dd" placeholder="请选择"></el-date-picker> -->
              </el-form-item>
              <!-- <el-form-item prop="code">
                <span>止：</span>
                <el-date-picker v-model="Riskcontrol.limitFinishTime" :disabled="currenindex==2" style="width: 225px" type="date" value-format="yyyy-MM-dd" placeholder="请选择"></el-date-picker>
              </el-form-item> -->
            </div>
          </div>
          <div>
            <div class="control-title">限量</div>
            <div style="padding: 20px">
              <el-form-item prop="code">
                <span slot="label">预估用砼量：</span>
                <div>{{ Riskcontrol.estimateNum }}立方米</div>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">限量设置：（立方米）</span>
                <el-input v-model="Riskcontrol.limitEstimateNum" :disabled="currenindex==2" style="width: 250px" placeholder="请输入" clearable onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="Riskcontrol.limitEstimateNum=$regExp.checkNum(Riskcontrol.limitEstimateNum)" @blur="Riskcontrol.limitEstimateNum=$regExp.blurCheckNum(Riskcontrol.limitEstimateNum)"></el-input>
              </el-form-item>
            </div>
          </div>
          <div>
            <div class="control-title">限额</div>
            <div style="padding: 20px">
              <el-form-item prop="code">
                <span slot="label">预估成本：</span>
                <div>{{ Riskcontrol.estimateCost }}万</div>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">预估产值：</span>
                <div>{{ Riskcontrol.forecastEarnings }}万</div>
              </el-form-item>
              <el-form-item prop="code">
                <span slot="label">限价设置：（万）</span>
                <el-input v-model="Riskcontrol.limitPrice" :disabled="currenindex==2" style="width: 250px" placeholder="请输入" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="Riskcontrol.limitPrice=$regExp.checkNum(Riskcontrol.limitPrice)" @blur="Riskcontrol.limitPrice=$regExp.blurCheckNum(Riskcontrol.limitPrice)"></el-input>
              </el-form-item>
            </div>
          </div>
        </div>
        <div style="padding:20px 30px;">
          <span>是否限制生产：</span>
          <el-radio v-model="Riskcontrol.isPro" :disabled="currenindex==2" :label="0">否</el-radio>
          <el-radio v-model="Riskcontrol.isPro" :disabled="currenindex==2" :label="1">是</el-radio>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="restOther">取 消</el-button>
        <el-button v-if="currenindex!=2" class="bottom_all" style="margin-left: 24px" @click="submitRiskcontrol()">提交审核</el-button>
      </span>
    </el-dialog>
    <!-- 分配账号 -->
    <el-dialog v-dialogDrag :visible.sync="shareVisible" width="1100px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">分配账号</span>
      <div class="form-title">我方人员：</div>
      <el-table v-loading="loadingA" :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="shareListA" tooltip-effect="dark">
        <el-table-column prop="name" label="角色">
          <template slot-scope="scope">
            <span v-if="scope.$index==0">销售员</span>
            <span v-if="scope.$index==1">预算员</span>
            <span v-if="scope.$index==2">质量服务员</span>
            <span v-if="scope.$index==3">供应保障员</span>
          </template>
        </el-table-column>
        <el-table-column label="人员">
          <template slot-scope="scope">
            <div v-for="(item,k) in scope.row.list" :key="k" style="margin-bottom:5px;">
              <el-select v-model="item.userId" :disabled="scope.$index<2&&disabledType==true || currenindex==2" style="width:80%;margin-right:10px;" @change="changePerson($event,item,scope.row.Userlist,1)">
                <el-option v-for="(item, index) in scope.row.Userlist" :key="index" :label="item.name" :value="item.id"></el-option>
              </el-select>
              <el-button v-if="k == 0" type="text" class="bottom_text" @click="addData(scope.row,item)">添加</el-button>
              <el-button v-else type="text" style="color:red;" @click="delData(scope.row,k)">删除</el-button>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="电话">
          <template slot-scope="scope">
            <div v-for="(item,k) in scope.row.list" :key="k" style="margin-bottom:5px;">
              <div style="height:36px;line-height: 36px;">{{item.phone}}</div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="accountNumber" label="登录账号">
          <template slot-scope="scope">
            <div v-for="(item,k) in scope.row.list" :key="k" style="margin-bottom:5px;">
              <div style="height:36px;line-height: 36px;">{{item.accountNumber}}</div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="form-title">客户方人员：</div>
      <el-table v-loading="loadingB" :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="shareListB" tooltip-effect="dark">
        <el-table-column label="角色">
          <template slot-scope="scope">
            <span v-if="scope.$index==0">计划下单员</span>
            <span v-if="scope.$index==1">通知发料员</span>
            <span v-if="scope.$index==2">用料签收员</span>
            <span v-if="scope.$index==3">用料结算员</span>
            <span v-if="scope.$index==4">工地周材负责人</span>
          </template>
        </el-table-column>
        <el-table-column label="人员">
          <template slot-scope="scope">
            <div v-for="(item,k) in scope.row.list" :key="k" style="margin-bottom:5px;">
              <el-select v-model="item.userId" :disabled="scope.$index==2&&disabledType==true ||currenindex==2" style="width:80%;margin-right:10px;" @change="changePerson($event,item,scope.row.Userlist,2)">
                <el-option v-for="(item, index) in scope.row.Userlist" :key="index" :label="item.name" :value="item.id"></el-option>
              </el-select>
              <el-button v-if="k == 0" class="bottom_text" type="text" @click="addData(scope.row,item)">添加</el-button>
              <el-button v-else type="text" style="color:red;" @click="delData(scope.row,k)">删除</el-button>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="电话">
          <template slot-scope="scope">
            <div v-for="(item,k) in scope.row.list" :key="k" style="margin-bottom:5px;">
              <div style="height:36px;line-height: 36px;">{{item.phone}}</div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="accountNumber" label="登录账号">
          <template slot-scope="scope">
            <div v-for="(item,k) in scope.row.list" :key="k" style="margin-bottom:5px;">
              <div style="height:36px;line-height: 36px;">{{item.accountNumber}}</div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="shareVisible = false">关 闭</el-button>
        <el-button v-if="currenindex!=2" class="bottom_all" style="margin-left: 24px" @click="hanldeSureFun()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import mixin from "@/mixins/ICPSmixin.js";
import clarificaitonModel from "./components/clarificaitonModel";
import { queryPage, Download } from "@/api/internetSales/projectManagement.js";
import { QueryOneByid } from "@/api/internetSales/chanceManagement.js";
import { queryPage as getCustomerData } from '@/api/basedata/user';
import { getLists as getEconomic, saveOrUpdate, getSaleNumber } from "@/api/internetSales/economic.js";
import {
  getRevisePrice,
  updateRevisePrice,
  deleteRevisePrice,
  getDisInfo,
  updateDisInfo,
  getListByType,
  saveListByType,
  // updateRiskControl,
  getListByid,
  Update,
  saveOrUpdateaccounts,
  deletesaccounts,
  getDetailsRiskControl,
  saveOrupdate,
  getOrupdate,
  clientGet_function,
  judeJurisdiction,
} from "@/api/internetSales/performanceRecord.js";
import { get_simple_user_listBycompanyId } from '@/api/GHnumber/contract'
export default {
  components: {
    clarificaitonModel,
  },
  mixins: [mixin],
  data() {
    return {
      currenindex: 1,
      contractTypelist: [
        {
          value: "供应中",
          status: 1,
        },
        {
          value: "供应完成",
          status: 2,
        },
      ],
      loadingA: false,
      loadingB: false,
      isReadOnly: false,
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      DownloadURL: Download,
      /*表单页类型，0为无树状，1为有树状，有树状在el-main加上display:flex*/
      pagesType: 0,
      /*添加表单数据*/
      show: false,
      fromDate: {},
      clarifiVisible: false,
      claritem: {},
      /*其他弹窗*/
      Dialog: [
        "priceDialog",
        "DisInfo",
        "ByType",
        "AccountDialog",
        "Riskcontrol",
      ],
      activeDialog: "",
      lowId: "",
      /*价格调整*/
      priceData: {
        surcharge: [],
        tab: [],
        adjustSurcharge: [],
        adjustTab: [],
      },
      pricingdialog: false,
      pricingType: 1,
      pricingId1: "",
      pricingId2: "",
      pricingIds1: [],
      pricingIds2: [],
      pricingData1: {
        revisePrice: "",
        effectiveDate: "",
      },
      pricingData2: {
        revisePrice: "",
        effectiveDate: "",
      },
      /*供应约定*/
      DisInfoData: {},
      /*资信记录*/
      ByTypeData: [],
      type: 1,
      econType: 1,
      content: "",
      /*账款记录*/
      AccountData: {},
      AccountableData: [],
      accountItem: { realIncome: '' },
      accountItemDialog: false,
      /*风险管控*/
      Riskcontrol: {
        isPro: 0,
      },
      /*数据导入*/
      exportDialog: false,
      loading: false,
      shareVisible: false,
      economicVisible: false,
      economicForm: {},
      economicData: [],
      shareList: [],
      shareListAB: [],
      shareListA: [],
      shareListB: [],
      customerList: [],
      shareData: {},
      keyId: '',
      disabledType: false,
    };
  },
  created() {
    this.tableParam = { ...this.tableParam, isAssess: 5 };
    this.tableParam.status = this.currenindex
    this.gettableData();
    this.getUserData();
  },
  watch: {
    type() {
      this.getByTypeData(this.type);
    },
  },
  methods: {
    choose(num) {
      this.currenindex = num;
      this.tableParam.status = this.currenindex
      this.gettableData();
    },
    hanldeSureFun() {
      this.shareList = [...this.shareListA[0].list, ...this.shareListA[1].list, ...this.shareListA[2].list, ...this.shareListA[3].list, ...this.shareListB[0].list, ...this.shareListB[1].list, ...this.shareListB[2].list, ...this.shareListB[3].list,]
      console.log(JSON.parse(JSON.stringify(this.shareList)))
      console.log(JSON.parse(JSON.stringify(this.shareListAB)))
      let update = this.shareList.filter((res) =>
        this.shareListAB.some((item) => res.id == item.id)
      );
      let deleteData = this.shareListAB.filter(
        (res) => !update.some((item) => res.id == item.id)
      );
      deleteData.forEach((res) => {
        res.status = 0; //是删除
      });
      let addData = this.shareList.filter(
        //新增的type默认写死为 1
        (res) => !update.some((item) => res.id == item.id)
      );
      console.log(JSON.parse(JSON.stringify(update)), 'update')
      console.log(JSON.parse(JSON.stringify(deleteData)), 'deleteData')
      console.log(JSON.parse(JSON.stringify(addData)), 'addData')
      this.shareList = [...update, ...deleteData, ...addData];
      console.log(JSON.parse(JSON.stringify(this.shareList)))
      let type = false
      this.shareList.forEach((v) => {
        if (this.shareList.filter((res) => res.userId == v.userId && res.roleId == v.roleId && v.status != 0).length == 2) {
          type = true
        }
      })
      if (type) {
        this.$message.warning('存在重复的账号，请不要重复添加');
        return
      }
      for (let i = 0; i < this.shareList.length; i += 1) {
        if (!this.shareList[i].userId) {
          this.$message.warning('数据不能为空！');
          return
        }
      }
      console.log(JSON.parse(JSON.stringify(this.shareList)))
      //验证是否有权限功能，仅提示---结束
      saveOrupdate(this.shareList).then(res => {
        if (res.code === 1001) {
          this.$message.success('分配成功');
          this.shareVisible = false;
        }
      })
      //验证是否有权限功能，仅提示---开始
      let list = []
      this.shareListB.forEach((v) => {
        v.list.forEach((v2) => {
          if (v2.userId) {
            list.push({ id: v2.userId, name: v2.name, type: 1 })//1：PC；2：移动端；3：微信小程序；4：首页
          }
        })
      })
      clientGet_function(list).then((res) => {
        let json = {
          id: this.shareData.id,//工程id，合同的分配传合同id
          status: 1,//1 客户 2 供应商
          jurisdictionList: res.data
        }
        judeJurisdiction(json).then((res) => {
          console.log(res);
          let div = ``
          res.data.forEach((v) => {
            div += `<div style="word-break: break-all;word-wrap: break-word;font-weight: 100;">` + v + `</div>`
          })
          this.$notify({
            title: '温馨提示',
            dangerouslyUseHTMLString: true,
            message: '<strong>' + div + '</strong>',
            position: 'bottom-right',
            duration: 0
          });
        })
      })
      //验证是否有权限功能，仅提示---结束
    },
    /**
     * @Description: 获取类型为客户的账号
     * @Param: 
     * @Author: wangwangwang
     */
    getUserData() {
      console.log(99);
      const params = {
        page: 1,
        pageSize: 1000,
        userTypeName: '客户',
      }
      getCustomerData(params).then(res => {
        if (res.code === 1001) {
          this.customerList = res.data.data;
          console.log(this.customerList);
        }
      })
    },
    init() {
      /*重置数据*/
      this.tableParam.page = 1;
      this.tableParam.name = "";
      this.tableParam.roadwork = "";
      this.tableParam.principal = "";
      this.tableParam.code = "";
      this.tableParam.time = [];
      this.tableParam.createTime = "";
      this.tableParam.updateTime = "";
      this.tableParam.financialCode = "";
      this.gettableData();
    },
    searchSubmit() {
      if (this.tableParam.time && this.tableParam.time.length) {
        this.tableParam.createTime = this.tableParam.time[0];
        this.tableParam.updateTime = this.tableParam.time[1];
      }
      this.tableParam.page = 1;
      this.gettableData();
    },
    /*查看详情*/
    datails(low) {
      console.log(low.id);
      QueryOneByid({ id: low.id }).then((res) => {
        this.fromDate = res.data;
        this.show = true;
      });
    },
    /*交底*/
    regisSubmit(data, isReadOnly, type) {
      this.claritem = data;
      this.clarifiVisible = true;
      this.isReadOnly = isReadOnly;
      this.type = type;
    },
    closeSubmit() {
      this.clarifiVisible = false;
    },
    /*价格调整*/
    hanldeprice(low) {
      getRevisePrice({ enginnerId: low.id }).then((res) => {
        this.priceData = res.data;
        this.activeDialog = "priceDialog";
      });
    },
    restOther() {
      this.activeDialog = "";
    },
    pricing(type) {
      this.pricingType = type;
      this.pricingdialog = true;
    },
    submitpricing() {
      let _this = this;
      let arr = [];
      if (_this.pricingType == 1) {
        arr.push({ ..._this.pricingData1, id: _this.pricingId1 });
        arr.push({ ..._this.pricingData2, id: _this.pricingId2 });
      } else {
        _this.pricingIds1.forEach((res) => {
          arr.push({ ..._this.pricingData1, id: res });
        });
        _this.pricingIds2.forEach((res) => {
          arr.push({ ..._this.pricingData2, id: res });
        });
      }
      updateRevisePrice(arr).then(() => {
        _this.hanldeprice(_this.pricingType);
      });
    },
    deleteprice(low, index, arr) {
      this.$confirm("此操作将永久删除该信息?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        cancelButtonClass: "bottom_all_two",
        confirmButtonClass: "bottom_all",
        type: "warning",
      })
        .then(() => {
          deleteRevisePrice({ id: low.id }).then(() => {
            arr.splice(index, 1);
          });
        })
        .catch(() => { });
    },
    /*供应约定*/
    hanldeDisInfo(low) {
      this.lowId = low.id;
      getDisInfo({ engineeringId: low.id }).then((res) => {
        this.DisInfoData = res.data;
        this.activeDialog = "DisInfo";
      });
    },
    submitDisInfo() {
      updateDisInfo({
        engineeringId: this.lowId,
        buildEndTime: this.DisInfoData.buildEndTime,
        lastSupplyTime: this.DisInfoData.lastSupplyTime,
        firstSupplyTime: this.DisInfoData.firstSupplyTime,
        plusOrMinusTime: this.DisInfoData.plusOrMinusTime,
        supplyRemark: this.DisInfoData.supplyRemark,
      }).then((res) => {
        if (res.code === 1001) {
          this.activeDialog = "";
          this.$message.success('保存成功')
        }
      });
    },
    /*资信记录*/
    hanldeByType(low) {
      this.lowId = low.id;
      this.activeDialog = "ByType";
      this.getByTypeData(this.type);
    },
    getByTypeData(type) {
      getListByType({ engineeringManagementId: this.lowId, type: type }).then(
        (res) => {
          this.ByTypeData = res.data;
        }
      );
    },
    submitByType() {
      saveListByType({
        engineeringManagementId: this.lowId,
        type: this.type,
        content: this.content,
        turnoverTime: "",
      }).then((res) => {
        if (res.code * 1 === 1001) {
          this.$message.success("记录更新成功")
          this.activeDialog = "";
          this.content = ''
        }

      });
    },
    /*账款记录*/
    hanldeAccount(low) {
      this.lowId = low.id;
      this.getAccountableData();
      this.initEconomic();
      this.activeDialog = "AccountDialog";
    },
    submitAccountData() {
      Update(this.AccountData).then(() => { });
    },
    getAccountableData() {
      getListByid({ engineeringManagementId: this.lowId }).then((res) => {
        this.AccountableData = res.data;
      });
    },
    addaccountItem() {
      this.accountItemDialog = true;
      this.$data.accountItem = this.$options.data().accountItem
    },
    /**
     * @Description: 获取经济效益列表
     * @Param: 
     * @Author: wangwangwang
     */
    initEconomic() {
      const params = {
        enginnerId: this.lowId,
      }
      getEconomic(params).then(res => {
        if (res.code === 1001) {
          this.economicData = res.data;
        }
      })
    },
    addEconomic() {
      this.economicVisible = true;
      this.economicForm = {};
    },
    /**
     * @Description: 添加经济效益
     * @Param: 
     * @Author: wangwangwang
     */
    handleAdd() {
      this.$refs.economicForm.validate((valid) => {
        if (valid) {
          let data = {
            id: this.economicForm.id,
            enginnerId: this.lowId,
            yearMouth: this.economicForm.yearMouth,
            sales: this.economicForm.sales,
            unitPrice: this.economicForm.unitPrice,
            cost: this.economicForm.cost,
            financialExpense: this.economicForm.financialExpense,
            settlementAdjustment: this.economicForm.settlementAdjustment,
          };
          saveOrUpdate(data).then((res) => {
            if (res.code === 1001) {
              this.$message.success('新增成功')
              this.economicVisible = false;
              this.initEconomic();
            }
          });
        }
      });
    },
    /**
     * @Description: 获取销量
     * @Param: 
     * @Author: wangwangwang
     * @param {*} low
     */
    getSales() {
      if (!this.economicForm.yearMouth) {
        this.$message.warning('请先选择月份')
        return
      }
      const params = {
        engineeringId: this.lowId,
        yearMouth: this.economicForm.yearMouth,
      }
      getSaleNumber(params).then(res => {
        if (res.code === 1001) {
          if (!res.data) {
            this.$message.warning('选择日期下销量为空');
            return;
          }
          this.economicForm.sales = res.data;
        }
      })
    },
    updateaccountItem(low) {
      this.accountItem = this.copy(low);
      this.accountItemDialog = true;
    },
    delteteaccountItem(low) {
      this.$confirm("此操作将永久删除该信息?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        cancelButtonClass: "bottom_all_two",
        confirmButtonClass: "bottom_all",
        type: "warning",
      })
        .then(() => {
          deletesaccounts({ id: low.id }).then(() => {
            this.getAccountableData();
          });
        })
        .catch(() => { });
    },
    submitaccountItem() {
      saveOrUpdateaccounts({
        ...this.accountItem,
        engineeringManagementId: this.lowId,
      }).then(() => {
        this.getAccountableData();
        this.accountItemDialog = false;
      });
    },
    /*风险管控*/
    hanldeRiskcontrol(low) {
      this.keyId = low.id;
      getDetailsRiskControl({ engineeringManagementId: low.id }).then((res) => {
        this.activeDialog = "Riskcontrol";
        this.$data.Riskcontrol = this.$options.data().Riskcontrol
        this.Riskcontrol = { ...this.Riskcontrol, ...res.data };
        if (res.data && res.data.limitBeginTime && res.data.limitFinishTime) {
          this.Riskcontrol.limitTime = [res.data.limitBeginTime, res.data.limitFinishTime]
        }
        if (this.Riskcontrol.isPro == null) {
          this.Riskcontrol.isPro = 0
        }
      });
    },
    /**
     * @Description: 分配账号
     * @Param: 
     * @Author: wangwangwang
     */
    hanldeShare(data) {
      this.shareVisible = true;
      this.shareData = data;
      this.shareListA = [
        {
          engineeringId: data.id, roleId: '12b2f6ff304148fd89141e9faa9afb96', // 销售员
          userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: '12b2f6ff304148fd89141e9faa9afb96',
            userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        {
          engineeringId: data.id, roleId: '48d84b503be7484ca1b5c2eade1ff004', // 预算员
          userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: '48d84b503be7484ca1b5c2eade1ff004',
            userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        {
          engineeringId: data.id, roleId: '159c04ddb13d47e698dd49440fb144ad', // 质量服务员
          userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: '159c04ddb13d47e698dd49440fb144ad',
            userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        {
          engineeringId: data.id, roleId: 'e50bee5031774a9dafb7216a1c4344f4', // 供应保障员
          userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: 'e50bee5031774a9dafb7216a1c4344f4',
            userType: 1, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
      ]
      this.shareListB = [
        {
          engineeringId: data.id, roleId: 'a8f16dc03d73445b8de3e2d055154fde', // 计划下单员
          userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: 'a8f16dc03d73445b8de3e2d055154fde',
            userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        {
          engineeringId: data.id, roleId: '8c9a2fc9f59044dcba355366b3a068db', // 通知发料员
          userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: '8c9a2fc9f59044dcba355366b3a068db',
            userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        {
          engineeringId: data.id, roleId: '3e32ac0a1e95449d91d80bd97bd30ec7', // 用料签收员
          userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: '3e32ac0a1e95449d91d80bd97bd30ec7',
            userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        {
          engineeringId: data.id, roleId: 'd88f92f475464fabac873ab70ed4e9f9', // 用料结算员
          userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
          list: [{
            engineeringId: data.id,
            roleId: 'd88f92f475464fabac873ab70ed4e9f9',
            userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '',
          }],
        },
        // {
        //   engineeringId: data.id, roleId: '5b1ca600fb4f4a7e898506bc803449f6', // 工地周材负责人
        //   userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '', Userlist: [],
        //   list: [{            engineeringId: data.id,
        //     roleId: '5b1ca600fb4f4a7e898506bc803449f6', // 计划下单员
        //     userType: 2, userId: '', userName: '', name: '', phone: '', accountNumber: '',          }],
        // },
      ]
      this.loadingA = true
      this.loadingB = true
      getOrupdate({ id: data.id }).then(async (res) => {
        if (res.code === 1001) {
          console.log(res.data.length > 0);
          if (res.data.length > 0) {
            this.shareListAB = JSON.parse(JSON.stringify(res.data))
            // this.shareListA = res.data.slice(0, 4);
            // this.shareListB = res.data.slice(4, 9);
            this.shareListA[0].list = res.data.filter((res) =>
              res.roleId == '12b2f6ff304148fd89141e9faa9afb96'
            )
            console.log(this.shareListA[0].list);
            this.shareListA[1].list = res.data.filter((res) =>
              res.roleId == '48d84b503be7484ca1b5c2eade1ff004'
            )
            this.shareListA[2].list = res.data.filter((res) =>
              res.roleId == '159c04ddb13d47e698dd49440fb144ad'
            )
            this.shareListA[3].list = res.data.filter((res) =>
              res.roleId == 'e50bee5031774a9dafb7216a1c4344f4'
            )
            this.shareListB[0].list = res.data.filter((res) =>
              res.roleId == 'a8f16dc03d73445b8de3e2d055154fde'
            )
            this.shareListB[1].list = res.data.filter((res) =>
              res.roleId == '8c9a2fc9f59044dcba355366b3a068db'
            )
            this.shareListB[2].list = res.data.filter((res) =>
              res.roleId == '3e32ac0a1e95449d91d80bd97bd30ec7'
            )
            this.shareListB[3].list = res.data.filter((res) =>
              res.roleId == 'd88f92f475464fabac873ab70ed4e9f9'
            )
            // this.shareListB[4].list = res.data.filter((res) =>
            //   res.roleId == '5b1ca600fb4f4a7e898506bc803449f6'
            // )
          }
          for (let i = 0; i < this.shareListA.length; i++) {
            await get_simple_user_listBycompanyId({
              roleId: this.shareListA[i].roleId,
              orgznizationId: this.shareData.companyId
            }).then((res) => {
              if (!res) {
                throw Error();
              }
              this.shareListA[i].Userlist = res ?.data; // 人员
              this.shareListA[i].engineeringId = data.id
              if (i == 3 && res) {
                this.loadingA = false
              }
            });
          }
          for (let i = 0; i < this.shareListB.length; i++) {
            await get_simple_user_listBycompanyId({
              roleId: this.shareListB[i].roleId,
              // orgznizationId: this.shareData.companyId
            }).then((res) => {
              this.shareListB[i].Userlist = res ?.data; // 人员
              this.shareListB[i].engineeringId = data.id
              if (i == 3 && res) {
                this.loadingB = false
              }
            });
          }
          if (res.data.length == 0) {//没有分配账号时，默认赋值销售员，预算员，用料签收员
            let item = this.shareListA[0].Userlist.find((v) => v.id == this.shareData.sallerId)
            if (item) {
              this.shareListA[0].list[0].userId = item.id
              this.shareListA[0].list[0].name = item.name
              this.shareListA[0].list[0].phone = item.phone
              this.shareListA[0].list[0].accountNumber = item.accountNumber
              this.shareListA[0].list[0].userType = 1
            }
            let item2 = this.shareListA[1].Userlist.find((v) => v.id == this.shareData.budgetPersonId)
            if (item2) {
              this.shareListA[1].list[0].userId = item2.id
              this.shareListA[1].list[0].name = item2.name
              this.shareListA[1].list[0].phone = item2.phone
              this.shareListA[1].list[0].accountNumber = item2.accountNumber
              this.shareListA[1].list[0].userType = 1
            }
            let item3 = this.shareListB[2].Userlist.find((v) => v.id == this.shareData.firstPartySignerId)
            if (item3) {
              this.shareListB[2].list[0].userId = item3.id
              this.shareListB[2].list[0].name = item3.name
              this.shareListB[2].list[0].phone = item3.phone
              this.shareListB[2].list[0].accountNumber = item3.accountNumber
              this.shareListB[2].list[0].userType = 2
            }

          }
        }
      })
    },
    /**添加人员 */
    addData(row, item) {
      row.list.push(
        { ...item, userId: '', phone: '', accountNumber: '', id: '' }
      )
    },
    /**删除人员 */
    delData(row, k) {
      row.list.splice(k, 1)
    },
    changePerson(userId, row, list, userType) {
      let item = list.find((v) => v.id == userId)
      row.name = item.name
      row.phone = item.phone
      row.accountNumber = item.accountNumber,
        row.userType = userType
    },
    submitRiskcontrol() {
      this.$router.push({ name: 'RiskControlFlow', query: { ...this.Riskcontrol, keyId: this.keyId, type: 1 }, })
    },
  },
};
</script>

<style lang="scss" scoped>
.control {
  display: flex;
  justify-content: space-around;
  > div {
    width: 300px;
    height: 400px;
    border-radius: 5px;
    border: 1px solid #e1e5ed;
    .control-title {
      font-size: 14px;
      color: #000;
      font-weight: bold;
      background: #e1e5ed;
      @include discen;
      height: 48px;
    }
  }
}
.dialoginfo-title {
  > div {
    cursor: pointer;
  }
  height: 48px;
  display: flex;
  background: linear-gradient(
    180deg,
    rgba(250, 252, 255, 1) 0%,
    rgba(245, 247, 250, 1) 100%
  );
  .none {
    font-weight: bold;
    height: 48px;
    @include discen;
    width: calc(100% / 2);
    border-bottom: 1px solid #e1e5ed;
    > div {
      line-height: 48px;
      border-bottom: 1px rgba(0, 0, 0, 0) solid;
    }
  }
  .active {
    font-weight: bold;
    height: 48px;
    @include discen;
    width: calc(100% / 2);
    border: 1px solid #e1e5ed;
    border-bottom: 0;
    background: #ffffff;
    > div {
      color: $bg_color;
      line-height: 48px;
      border-bottom: 1px $bg_color solid;
    }
  }
}
.dialoginfo-info {
  padding: 20px 20px 0 0px;
  overflow: auto;
  height: calc(85vh - 428px);
  .el-select,
  .el-input,
  .el-date-picker {
    width: 100%;
  }
}
.radio {
  overflow: auto;
  height: calc(100vh - 533px);
  width: 320px;
  .el-radio {
    margin-right: 0px;
  }
  padding: 20px;
  .radio-bg {
    width: 100%;
    height: 28px;
  }
  i {
    color: #808080;
    margin-left: 5px;
  }
  i:hover {
    color: $bg_color;
  }
}
.price-table1 {
  display: flex;
  justify-content: space-between;
  > div {
    width: 49%;
  }
}
.show {
  padding: 0 !important;
  .el-input,
  .el-select {
    width: 227px;
  }
  .dialoginfo {
    padding: 0;
  }
  .form-title {
    font-size: 18px;
    margin: 10px 0;
  }
}
.form-title {
  font-size: 18px;
  margin: 10px 0;
  font-weight: 600;
}
.el-input,
.el-select {
  width: 240px;
}
.project-name {
  font-size: 18px;
}
.accout-container {
  margin: 10px 0;
  .accout-list {
    margin: 10px 0;
  }
}
.form-title {
  font-size: 18px;
  margin: 10px 0;
}
.table_link {
  margin-left: 10px;
  color: $bg_color;
}

.table_link:hover {
  opacity: 0.8;
}
.no-data {
  text-align: center;
}
</style>
